package logic.projectiles;

import java.awt.Rectangle;

import logic.blocks.Block;
import logic.enemies.Enemy;
import logic.entities.GameObject;
import logic.pruebas.GamePanel;

/**
 * @author Unai
 * Proyectil de la habilidad especial de Zabuza. Solo desaparece al impactar con bloques
 *
 */
public class BlueWolf extends Projectile{
	private static final long serialVersionUID = 2377921214161168253L;

	public BlueWolf(float x, float y, GamePanel panel, String nomImg, boolean direction, int damage, boolean friendly) {
		super(x, y, panel, nomImg);
		if (direction) {
			velX = 250;
		} else {
			velX = -250;
		}
		
		velY = 0;
		this.damage = damage;
		this.friendly = friendly;
		falling = false;
	}

	public void impact(GameObject object) {
		if (dibujado) {
			if (object.dibujado && !object.dead) {
				Rectangle objRectangle = new Rectangle((int)object.coorX, (int)object.coorY, object.anchura, object.altura);
				Rectangle thisObject = new Rectangle((int)coorX, (int)coorY, anchura, altura);

				if (objRectangle.intersects(thisObject)) {
					if (object instanceof Enemy && friendly) {
						Enemy tempE = (Enemy) object;
						tempE.magicDamage(damage);
					} else if (object instanceof Block) {
						impacted = true;
					}
				}
			}
		}
	}

}
